<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>logo</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="../../../static/images/favicon.ico" th:href="@{/images/favicon.ico}">
    <link rel="stylesheet" href="../../../static/plugin/layui/css/layui.css" th:href="@{/plugin/layui/css/layui.css}" media="all"/>
    <link rel="stylesheet" href="../../../static/back_css/create_works.css" th:href="@{/back_css/create_works.css}" media="all">
</head>
<body>
<div id="create_works_main">
    <div class="create_works_content">
          <form class="layui-form">

          <div class="layui-form-item">
              <label class="layui-form-label">系统logo</label><br>
              <div class="layui-input-block">
                  <input type="hidden" name="WORK_IMGURL" id="work_cover">
                  <input type="file" autocomplete="off" name="file1" class="layui-input upload_file" accept="image/*" id="test1">
                  <div class="upload_img layui-upload-list">
                      <img  class="layui-upload-img" id="demo1">
                      <span>请上传PNG、JPG、GIF格式图片</span>
                  </div>
              </div>
          </div>
          <input type="hidden" th:value="${logo.getLOGO_IMG()}"/>
          <input type="hidden" th:value="${logo.getFANCE_IMG()}"/>
          <input type="hidden" th:value="${logo.getWX_IMG()}"/>
          <input type="hidden" th:value="${logo.getWX_COUNT()}"/>
          <input type="hidden" th:value="${logo.getSERVER_ID()}"/>
          <input type="hidden" th:value="${logo.getID()}"/>
          </form>
    </div>
</div>

<script type="text/javascript" src="../../../static/plugin/layui/layui.js" th:src="@{/plugin/layui/layui.js}"></script>
<script>
    layui.use(['form', 'layedit', 'laydate','upload'], function() {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate
            ,upload = layui.upload
            ,$ = layui.jquery;

        var uploadInst = upload.render({
            elem: '#test1'
            , url: '/picUpload'
            , method:'post'
            , multiple: true
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo1').attr('src', result); //图片链接（base64）
                });
                $(".upload_file>span").css("display","none");
                $(".layui-upload-img").css("display","block");
            }
            ,done: function(res){
                //如果上传失败
                if(res.code == 0){
                    return layer.msg('上传失败');
                }
                $("#work_cover").val(res.pic);
                //上传成功
            }
        });
    })
</script>
</body>
</html>